# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Ronald van Haren <ronald.archlinux.org>

pkgname=suitesparse
pkgver=7.3.1
pkgrel=1
pkgdesc='A collection of sparse matrix libraries'
url='http://faculty.cse.tamu.edu/davis/suitesparse.html'
arch=(loong64 x86_64)
depends=(blas
         gcc-libs
         glibc
         gmp
         lapack
         mpfr)
makedepends=(cmake
             gcc-fortran)
replaces=('suitesparse64<7.1.0')
license=(GPL)
source=(https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('b512484396a80750acf3082adc1807ba0aabb103c2e09be5691f46f14d0a9718')

build() {
  cd SuiteSparse-$pkgver
  CXXFLAGS=${CXXFLAGS/-mlsx /}
  CXXFLAGS=${CXXFLAGS/-fstack-clash-protection/}
  CXXFLAGS+=" -ffat-lto-objects -mcmodel=extreme" \
  CMAKE_OPTIONS="-DBLA_VENDOR=Generic \
                 -DCMAKE_INSTALL_PREFIX=/usr \
                 -DCMAKE_BUILD_TYPE=None \
                 -DNSTATIC=ON" \
  make
#  -DALLOW_64BIT_BLAS=ON \
}

package() {
  cd SuiteSparse-$pkgver
  DESTDIR="$pkgdir" make install
}
